#coding=utf-8

from django.db import models

#from choices import NOTHING, FATAL, ERROR, INFO, DETAIL, DEBUG, ALL
from choices import LOGS_LEVEL_CHOICES, INFO

class Options (models.Model):
    ''' Opcje konfiguracyjne 
    
        W bazie danych istnieje zawsze tylko pojedynczy rekord opcji
    '''
    
    # zasoby systemu
    sessions = models.IntegerField (null=False, blank=False)
    domain = models.CharField (max_length=1024, default='filtr.kc.smtp', null=False, blank=False)
    listen_port = models.IntegerField (default=7777, null=False, blank=False)
    ssl_listen_port = models.IntegerField (default=7778, null=False, blank=False)
    logs_filepath = models.CharField (max_length=1024, default=u"logs.txt", null=False, blank=False)
    logs_level = models.IntegerField (choices=LOGS_LEVEL_CHOICES, default=INFO, null=False,blank=False)
    msg_max_size = models.IntegerField (null=False, blank=False) # w MB
    smtp_server_address = models.CharField (max_length=1024, default='localhost', null=False, blank=False)
    smtp_server_port = models.IntegerField (default=587, null=False, blank=False)
    allow_tmp_msgs = models.BooleanField (default=False,null=False, blank=False)
    allow_antivir = models.BooleanField (default=False, null=False, blank=False)
    redirect_address = models.CharField(max_length=1024, null=False,blank=False)
        
    def __unicode__ (self):
        return u'Opcje konfiguracyjne'
